package com.vhall.component.controller.chat.facade;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.vhall.component.entity.chat.vo.*;
import com.vhall.component.plugin.common.annotation.TokenAuth;
import com.vhall.component.plugin.common.annotation.VssTokenAuth;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

/**
 * @author xianglei
 * @date 2021/6/18 10:27
 */

@FeignClient(value = "ChatFacade", path = "/v4/chat")
public interface ChatFacade {

    /**
     * 历史聊天
     *
     * @param reqVo
     * @return
     */
    @PostMapping(value = "/list-bak")
    Map lists(@Validated ChatListReqVo reqVo);

    /**
     * 历史聊天（优化版）
     *
     * @param reqVo
     * @return
     * @author yuanzh
     * @date 2021/9/24
     */
    @VssTokenAuth
    @PostMapping(value = "/list")
    Map<String, Object> listMessage(@Validated ChatListReqVo reqVo);


    /**
     * 待审核消息列表
     *
     * @param reqVo
     * @return
     */
    @PostMapping(value = "/audit-lists")
    JSONArray auditLists(@Validated ChatAuditListReqVo reqVo);

    /**
     * 获取历史消息数据
     *
     * @param reqVo
     * @return
     */
    @PostMapping(value = "/message-lists")
    JSONObject messageLists(@Validated MessageListsReqVo reqVo);

    /**
     * 设置审核开关接口
     *
     * @param reqVo
     * @return
     */
    @PostMapping(value = "/set-channel-switch")
    JSONObject setChannelSwitch(@Validated ChannelSwitchSetReqVo reqVo);


    /**
     * 获取审核开关状态接口
     *
     * @param reqVo
     * @return
     */
    @PostMapping(value = "/get-channel-switch")
    JSONObject getChannelSwitch(@Validated ChannelSwitchReqVo reqVo);


    /**
     * 设置是否自动处理聊天数据接口（switch开启能发,不能收,会转到审核频道）
     *
     * @param reqVo
     * @return
     */
    @PostMapping(value = "/set-channel-switch-options")
    JSONObject setChannelSwitchOptions(@Validated ChannelSwitchOptionReqVo reqVo);

    /**
     * 审核消息操作
     *
     * @param reqVO
     * @return
     */
    @PostMapping("/apply-message-send")
    Boolean applyMessageSend(@Validated ApplyMessageSendReqVO reqVO);

    /**
     * 消息发送-原本发送消息的封装
     *
     * @param reqVO
     * @return
     */
    @TokenAuth
    @PostMapping("/send-message")
    Boolean sendMessage(@RequestBody @Validated SendMessageReqVO reqVO);

    /**
     * 图片上传
     *
     * @param reqVo
     * @return
     */
    @PostMapping("/upload")
    Map<String, Object> upload(@Validated ChatUploadReqVo reqVo);
}